# -*- coding:utf-8 -*-

from fastapi import FastAPI
from fastapi.exceptions import RequestValidationError

from starlette.exceptions import HTTPException as StarletteHTTPException

from core import exceptions

def add_exception_handlers(app: FastAPI):
    """
    Add exception handlers to the FastAPI app.
    """
    app.add_exception_handler(StarletteHTTPException, exceptions.http_exception_handler)
    app.add_exception_handler(RequestValidationError, exceptions.validation_exception_handler)
    app.add_exception_handler(500, exceptions.exception_handlers)